<?php
    $cp_ids = cpx_get_lastest_cp($itemsToShow, $coupon_type);
    if (count($cp_ids) > 0) { ?>
            <div class="row-fluid boxf">
                        <div class="row-fluid header-coupon">
                            <div class="span12 code-coupon">
                                <?php 
                                    if($coupon_type == 'code'){?>
                                        <h1><?php echo $title;?></h1>
                                    <?php }else{?>
                                        <h2><?php echo $title;?></h2>
                                    <?php }
                                ?>
                            </div>
                        </div>
    <?php 
    if ($coupon_type == 'code') { // If Coupon code
        foreach ($cp_ids as $cp_id) 
        {
            cpx_get_coupon_detail_2($cp_id, $kw_after_title);
        } // End foreach
    }// End Coupon code 
    else if ($coupon_type == 'promotion') { // If Promotion
        foreach ($cp_ids as $cp_id) 
        {
            cpx_get_coupon_detail_2($cp_id, $kw_after_title);
        }
    }//End Promotion
    if ($coupon_type == 'free_shipping') { // If Free shipping
        foreach ($cp_ids as $cp_id) 
        {
            cpx_get_coupon_detail_2($cp_id, $kw_after_title);
        } // end foreach
    }//End if Free shipping
?>
            </div>
<?php } ?>